<template>
  <div class="authContainer">
    <div class="timeCont" v-if="showCont && !showTimeOut">
      <div class="bannerCont">
        <img class="bannerImg" src="/img/banner/7.png" />
      </div>
      <div class="formCont">
        <div class="formTitle">意见箱</div>
        <div class="formArea">
          <van-field
            v-model="reportCont"
            rows="10"
            autosize
            style="background: none; font-size: 0.7rem"
            type="textarea"
            maxlength="1000"
            placeholder="请对自己做一个评价吧(例如：技术、兴趣、生活等。)"
            show-word-limit
          />
        </div>
        <div class="saveBtn" @click="reportFn">投递意见</div>
      </div>
    </div>
    <subLoad v-if="showSub"></subLoad>
  </div>
</template>
<script>
import { showSuccessToast, showFailToast } from "vant";
import { feedback } from "@/http/api";
import subLoad from "@/components/public/subLoad.vue";

export default {
  components: { subLoad },
  name: "",
  data() {
    return {
      showTimeOut: false,
      showCont: true,
      showSub: false,
      reportCont: "",
    };
  },
  props: {},
  setup() {},
  methods: {
    reportFn() {
      let data = {
        feedback_content: this.reportCont,
      };
      if (!this.showSub) {
        this.showSub = true;
        feedback(data)
          .then((res) => {
            if (res.data.code == 1) {
              this.reportCont = "";
              showSuccessToast("提交成功");
            } else {
              showToast(res.data.msg);
            }
            this.showSub = false;
          })
          .catch(() => {
            this.showSub = false;
          });
      }
    },
  },
  mounted() {},
  created() {},
};
</script>
<style scoped lang="less">
.authContainer {
  background-color: #e7eeff;
  padding-bottom: 2rem;
  box-sizing: border-box;
  min-height: 100vh;
  .bannerCont {
    width: 100%;
    color: #fff;
    display: flex;
    justify-content: space-between;
    box-sizing: border-box;
    .bannerImg {
      width: 100%;
    }
  }
  .formCont {
    background-color: #fff;
    width: 92%;
    margin: 0 auto;
    position: relative;
    margin-top: -2rem;
    padding: 1rem 4%;
    border-radius: 0.75rem;
    box-sizing: border-box;
    .formTitle {
      font-size: 0.8rem;
      font-weight: bold;
      margin-bottom: 1rem;
      .iconfont {
        color: #86a9fb;
        font-size: 1rem;
        margin-right: 0.25rem;
        position: relative;
        top: 0.05rem;
      }
    }
    .formArea {
      background-color: #e7eeff;
      border-radius: 0.25rem;
      margin-bottom: 1.25rem;
    }
    .saveBtn {
      width: 100%;
      padding: 0.75rem 0;
      text-align: center;
      background-image: linear-gradient(to right, #cbd8f7, #86a9fb);
      color: #fff;
      border-radius: 2rem;
    }
  }
}
</style>
